/**
 * 
 */
package com.skyme.automation.generate.common.bpm;

import java.util.ArrayList;
import java.util.List;

import com.skyme.automation.generate.common.ResourceString;

/**
 * bpm的管理工厂
 * @author zhangfeng
 * 
 */
public class BpmManagerFactory {

	// 工作流管理列表
	private static final List<BpmManager> BPM_LIST = new ArrayList<BpmManager>();
	// 工作流列表
	private static final List<String> BPM_ID_LIST = new ArrayList<String>();

	static void addDB(BpmManager manager) {
		BPM_LIST.add(manager);
		BPM_ID_LIST.add(manager.getId());
	}

	public static BpmManager getBpmManager(String database) {
		for (BpmManager manager : BPM_LIST) {
			if (manager.getId().equals(database)) {
				return manager;
			}
		}

		throw new IllegalArgumentException(
				ResourceString
						.getResourceString("error.bpm.is.not.supported")
						+ database);
	}

	public static List<String> getAllDBList() {
		return BPM_ID_LIST;
	}

}
